<template>
	<view>
		<view class="main">
			<textarea placeholder="请输入标题" auto-height v-model="title"></textarea>
			<textarea placeholder="请输入内容" auto-height v-model="content"></textarea>
		</view>
		<button @click="submit" class="bu" style="width: 200rpx;height: 80rpx;margin-top: 20rpx;" :class="this.title === '' || this.content === '' ? 'disabled' : ''">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				content: ''
			};
		},
		methods:{
			submit(){
				this.$request({
					url: '/prod-api/api/common/feedback',
					method: 'POST',
					data:{
						title: this.title,
						content: this.content
					}
				}).then(res => {
					if(res.code === 200){
						uni.showToast({
							title:'提交成功'
						})
						setTimeout(() => {
							uni.switchTab({
								url:'/pages/user/user'
							})
						}, 1000)
					}else{
						uni.showToast({
							title:res.msg,
							icon: 'error'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	view{
		.main{
			background-color: #fff;
			padding: 20rpx;
			textarea{
				border: 2rpx solid #e4e7ed;
				padding: 20rpx;
				margin: 0 auto;
				margin-top: 20rpx;
				min-height: 180rpx;
				border-radius: 10rpx;
				&:nth-child(2){
					min-height: 400rpx;
					margin-top: 80rpx;
				}
			}
		}
	}
</style>
